tidy fixes (#1179)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Fri, 15 Sep 2023 00:09:56 +0000 (18:09 -0600)
committerGitHub <noreply@github.com>
Fri, 15 Sep 2023 00:09:56 +0000 (18:09 -0600)
* tidy readability-convert-member-functions-to-static

* tidy readability-make-member-function-const

* kill trailing space

16 files changed:
duplicate.cc
exif.cc
filter_vecs.h
gdb.h
geo.cc
geo.h
googletakeout.h
gpx.cc
gtm.cc
igc.cc
igc.h
kml.cc
kml.h
position.cc
util.cc
vecs.h

index e79c1b4e99cc51787ef004521516bbe801629f68..dccfad8484395b6b1c897951bc4c574a84273c7f 100644 (file)
@@ -97,7 +97,7 @@ void DuplicateFilter::process()
         .arg(degrees2ddmm(waypointp->latitude), 11, 'f', 3)
         .arg(degrees2ddmm(waypointp->longitude), 11, 'f', 3);
     }
-  
+
     if (snopt) {
       key.append(waypointp->shortname);
     }
diff --git a/exif.cc b/exif.cc
index 25bcd7b06a8bb5b6a5450699bbdfad77f0ac9dac..2e0ba8289fce728e7d485a6514ced769a9fd5225 100644 (file)
--- a/exif.cc
+++ b/exif.cc
@@ -209,7 +209,7 @@ ExifFormat::exif_read_str(ExifTag* tag)
   // Panasonic DMC-TZ10 stores datum with trailing spaces.
   // Kodak stores zero count ASCII tags.
   QByteArray buf = (tag->count == 0) ? QByteArray("") : tag->data.at(0).toByteArray();
-  // If the bytearray contains internal NULL(s), get rid of the first and 
+  // If the bytearray contains internal NULL(s), get rid of the first and
   // anything after it.
   if (auto idx = buf.indexOf('\0'); idx >= 0) {
     buf = buf.left(idx);
@@ -1574,7 +1574,7 @@ ExifFormat::write()
       exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 0, dt.time().hour());
       exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 1, dt.time().minute());
       exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 2,
-                      static_cast<double>(dt.time().second()) + 
+                      static_cast<double>(dt.time().second()) +
                       static_cast<double>(dt.time().msec())/1000.0);
 
       exif_put_str(GPS_IFD, GPS_IFD_TAG_DATESTAMP, CSTR(dt.toString(u"yyyy:MM:dd")));
index 2abe2d36680d48740707b03756bd05fc7417d46a..beaaf0c3e655f0242b08b0cd200605eda5eb2a5d 100644 (file)
@@ -39,7 +39,7 @@ public:
   class fltinfo_t {
   public:
 
-    bool isDynamic() {
+    bool isDynamic() const {
       return factory != nullptr;
     }
     explicit operator bool() const {
diff --git a/gdb.h b/gdb.h
index 1e30b7b6ca43d422b0ea2ba814d85db5d7b0b500..6697ca592e62c59d86f9007881799f5387436559 100644 (file)
--- a/gdb.h
+++ b/gdb.h
@@ -85,7 +85,7 @@ public:
        * it’s in <qhashfunctions.h>, a public header.
        */
       QtPrivate::QHashCombine hash;
-      
+
       seed = hash(seed, c.shortname.toUpper());
       seed = hash(seed, c.lat);
       seed = hash(seed, c.lon);
diff --git a/geo.cc b/geo.cc
index 808a96121a17833d8ba598cfe5645f9ab49ca490..9baaa5d57dccfa78b92f383f4b15381c5781cfa3 100644 (file)
--- a/geo.cc
+++ b/geo.cc
@@ -33,7 +33,7 @@
 
 #define MYNAME "geo"
 
-void GeoFormat::GeoReadLoc(QXmlStreamReader& reader) const
+void GeoFormat::GeoReadLoc(QXmlStreamReader& reader)
 {
   Waypoint* wpt = nullptr;
   QString current_tag;
diff --git a/geo.h b/geo.h
index 884b47cdd0acc582bca49ed714a69949d9ba0dcc..ae1197702e2af46f84fadb8d36d642d3944bd7d6 100644 (file)
--- a/geo.h
+++ b/geo.h
@@ -60,7 +60,7 @@ private:
 
   /* Member Functions */
 
-  void GeoReadLoc(QXmlStreamReader& reader) const;
+  static void GeoReadLoc(QXmlStreamReader& reader);
   void geo_waypt_pr(const Waypoint*, QXmlStreamWriter& writer);
   static Geocache::container_t wpt_container(const QString&);
 
index d1db575935a233f983c6d2f39a8822fd1ce02c06..b3489d928df868fff3336d889aadbac6ac84ec16 100644 (file)
@@ -75,7 +75,7 @@ public:
 
   ff_type get_type() const override
   {
-   return ff_type_file; 
+   return ff_type_file;
   }
 
   QVector<ff_cap> get_cap() const override
@@ -86,7 +86,7 @@ public:
   void rd_init(const QString& fname) override
   {}
   void read() override;
+
 private:
   /* Constants */
 
diff --git a/gpx.cc b/gpx.cc
index 6d0a4c0428afef87a95e6d864cf668b1cfc227a4..cf404ed607a1c8264f3dcec2c5f5466d2842d238 100644 (file)
--- a/gpx.cc
+++ b/gpx.cc
@@ -981,7 +981,7 @@ GpxFormat::qualifiedName() const
    * file.  So we map from the namespaceUris to the prefixes used in our
    * hash table.
    */
-  static const QHash<QString, QString> tag_ns_prefixes = { 
+  static const QHash<QString, QString> tag_ns_prefixes = {
     {"http://www.garmin.com/xmlschemas/GpxExtensions/v3", "gpxx"},
     {"http://www.garmin.com/xmlschemas/TrackPointExtension/v1", "gpxtpx"},
     {"http://www.groundspeak.com/cache/1/0", "groundspeak"},
diff --git a/gtm.cc b/gtm.cc
index d2bf5fbfebafeecb0262555cf5f644a0aed06b0d..d4bdca5efc5a6830671186c387ef4cc63251b4b0 100644 (file)
--- a/gtm.cc
+++ b/gtm.cc
@@ -31,7 +31,7 @@
 #include <QString>              // for QString
 #include <QVector>              // for QVector
 
-#include "defs.h" 
+#include "defs.h"
 #include "gbfile.h"             // for gbfseek, gbfputc, gbfputint32, gbfputflt
 #include "jeeps/gpsmath.h"      // for GPS_Math_Known_Datum_To_WGS84_M
 #include "src/core/datetime.h"  // for DateTime
diff --git a/igc.cc b/igc.cc
index ba643762bb7bb8f5b2d92d92721c9ba37e62fcf4..11b2cfb6fe9a35f6092f7e6faf6e638aeccdee04 100644 (file)
--- a/igc.cc
+++ b/igc.cc
@@ -636,7 +636,7 @@ QByteArray IgcFormat::latlon2str(const Waypoint* wpt)
   return str;
 }
 
-QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt) const
+QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt)
 {
   QByteArray str = dt.toUTC().toString("ddMMyy").toUtf8();
   if (str.size() != 6) {
@@ -645,7 +645,7 @@ QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt) const
   return str;
 }
 
-QByteArray IgcFormat::tod2str(const gpsbabel::DateTime& tod) const
+QByteArray IgcFormat::tod2str(const gpsbabel::DateTime& tod)
 {
   QByteArray str = tod.toUTC().toString("hhmmss").toUtf8();
   if (str.size() != 6) {
@@ -826,7 +826,7 @@ void IgcFormat::wr_fix_record(const Waypoint* wpt, int pres_alt, int gnss_alt)
  * @return The number of seconds to add to the GNSS track in order to align
  *         it with the pressure track.
  */
-int IgcFormat::correlate_tracks(const route_head* pres_track, const route_head* gnss_track) const
+int IgcFormat::correlate_tracks(const route_head* pres_track, const route_head* gnss_track)
 {
   double alt_diff;
   double speed;
diff --git a/igc.h b/igc.h
index 17c6bdaa18fb78c573b4fba4ebcbd68cc5c0cdd5..4054a9150a1ff352fecd54237ab64bbaf0de3fbd 100644 (file)
--- a/igc.h
+++ b/igc.h
@@ -161,7 +161,7 @@ private:
    * A factor can never be zero, so this looks good to me.
    * Be careful.
    */
-  int get_ext_factor(igc_ext_type_t type) const
+  static int get_ext_factor(igc_ext_type_t type)
   {
     int ret = 0;
     switch (type) {
@@ -242,9 +242,9 @@ private:
   void detect_gnss_track(const route_head*);
   void detect_other_track(const route_head*, int& max_waypt_ct);
   void get_tracks(const route_head**, const route_head**);
-  QByteArray latlon2str(const Waypoint*);
-  QByteArray date2str(const gpsbabel::DateTime&) const;
-  QByteArray tod2str(const gpsbabel::DateTime&) const;
+  static QByteArray latlon2str(const Waypoint*);
+  static QByteArray date2str(const gpsbabel::DateTime&);
+  static QByteArray tod2str(const gpsbabel::DateTime&);
   void wr_header();
   void wr_task_wpt_name(const Waypoint*, const char*);
   void wr_task_hdr(const route_head*, unsigned int task_num);
@@ -252,7 +252,7 @@ private:
   void wr_task_tlr(const route_head*);
   void wr_tasks();
   void wr_fix_record(const Waypoint*, int, int);
-  int correlate_tracks(const route_head*, const route_head*) const;
+  static int correlate_tracks(const route_head*, const route_head*);
   void wr_track();
 
   /* Data Members */
diff --git a/kml.cc b/kml.cc
index dbf3e28b298bce4e4d4cbef31367a94d5024e5d9..92245bf0a72e3761f6889cac0ef48eb4022fe473 100644 (file)
--- a/kml.cc
+++ b/kml.cc
@@ -1226,7 +1226,7 @@ QString KmlFormat::kml_gc_mkstar(int rating)
 
 }
 
-QString KmlFormat::kml_geocache_get_logs(const Waypoint* wpt) const
+QString KmlFormat::kml_geocache_get_logs(const Waypoint* wpt)
 {
   QString r;
 
diff --git a/kml.h b/kml.h
index d51f190dc5592b9feb99a22e0a12e027904243c3..1262fe35c720d925f970240e783fb754a3bd1767 100644 (file)
--- a/kml.h
+++ b/kml.h
@@ -179,7 +179,7 @@ private:
   static QString kml_lookup_gc_icon(const Waypoint* waypointp);
   static const char* kml_lookup_gc_container(const Waypoint* waypointp);
   static QString kml_gc_mkstar(int rating);
-  QString kml_geocache_get_logs(const Waypoint* wpt) const;
+  static QString kml_geocache_get_logs(const Waypoint* wpt);
   void kml_write_data_element(const QString& name, const QString& value) const;
   void kml_write_data_element(const QString& name, int value) const;
   void kml_write_data_element(const QString& name, double value) const;
index fe5d658ca7d5bea65f19c4f8d92a73070ef0c17d..9060b916c6a39873b700c733bc0e3b763c5b7e1f 100644 (file)
@@ -37,23 +37,23 @@ void PositionFilter::position_runqueue(const WaypointList& waypt_list, int qtype
 {
   if (!waypt_list.empty()) {
     QList<WptRecord> qlist;
-  
+
     for (auto* const waypointp : waypt_list) {
       qlist.append(WptRecord(waypointp));
     }
     int nelems = qlist.size();
-  
+
     for (int i = 0 ; i < nelems ; ++i) {
       if (!qlist.at(i).deleted) {
         bool something_deleted = false;
-  
+
         for (int j = i + 1 ; j < nelems ; ++j) {
           if (!qlist.at(j).deleted) {
             double dist = gc_distance(qlist.at(j).wpt->latitude,
                                       qlist.at(j).wpt->longitude,
                                       qlist.at(i).wpt->latitude,
                                       qlist.at(i).wpt->longitude);
-  
+
             if (dist <= pos_dist) {
               if (check_time) {
                 qint64 diff_time = std::abs(qlist.at(j).wpt->creation_time.msecsTo(qlist.at(i).wpt->creation_time));
@@ -61,7 +61,7 @@ void PositionFilter::position_runqueue(const WaypointList& waypt_list, int qtype
                   continue;
                 }
               }
-  
+
               qlist[j].deleted = true;
               qlist.at(j).wpt->wpt_flags.marked_for_deletion = 1;
               something_deleted = true;
@@ -75,7 +75,7 @@ void PositionFilter::position_runqueue(const WaypointList& waypt_list, int qtype
             }
           }
         }
-  
+
         if (something_deleted && (purge_duplicates != nullptr)) {
           qlist.at(i).wpt->wpt_flags.marked_for_deletion = 1;
         }
diff --git a/util.cc b/util.cc
index 0e4d848f45edbcd9b7cbd61a350eaa6601bd4c98..38b464f3e2433b2493cc79e0483b2de724062325 100644 (file)
--- a/util.cc
+++ b/util.cc
@@ -351,7 +351,7 @@ make_datetime(QDate date, QTime time, bool is_localtime, bool force_utc, int utc
     result = date.startOfDay(timespec, offset);
 #endif
   }
+
   return result;
 }
 
@@ -1066,7 +1066,7 @@ QString grapheme_truncate(const QString& input, unsigned int count)
 
 int xstrtoi(const char* str, char** str_end, int base)
 {
-  
+
   long value = strtol(str, str_end, base);
   if (value > INT_MAX) {
     errno = ERANGE;
diff --git a/vecs.h b/vecs.h
index e2ccf48298f2b6a232bb4ae8c09d2d3d312026af..415f3b402b3038671899746573e2745f3f9afd63 100644 (file)
--- a/vecs.h
+++ b/vecs.h
@@ -44,7 +44,7 @@ public:
   class fmtinfo_t {
   public:
 
-    bool isDynamic() {
+    bool isDynamic() const {
       return factory != nullptr;
     }
     explicit operator bool() const {